<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>登录验证</title>
		<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
		<script>
			function checkUname(){
				//用户输入的规则
			username=$("#uname").val();
			reg = /^[a-zA-Z0-9]{3,10}$/;   //正则表达式
			if(!reg.test(username)){
				$("#uname").css("border-color","red");
			}
			else{
				$("#uname").css("border-color","");
			}
			}
			function checkUpsw(){
				psw=$("#upsw").val();
				reg = /^[0-9]{6}$/;
			if(!reg.test(psw)){
				$("#upsw").css("border-color","red");
			}
			else{
				$("#upsw").css("border-color","");
			}
			}		
			function checkAll(){
				checkUname()&&checkUpsw();
			}
		</script>
	</head>
	<body>
		<h3>用户名是字母数字的组合,3-10个;密码6个数字</h3>
                     <center>用户名:<input onblur="checkUname()" type="text" id="uname" /><br>
                      密&nbsp;&nbsp;&nbsp;&nbsp;码:<input onblur="checkUpsw()" type="text" id="upsw" /></center>
                      <br>
        <center><button onclick="checkAll()" id=button>登&nbsp;&nbsp;录</button></center>
	</body>
</html>